import java.util.StringTokenizer;
import java.util.Vector;


class P496_39643 {

	public static void main(String[] args) {
		
		String line = readLn();
		String line1;
		while (line != null) {
			line1 = readLn();
			
			process(line, line1);
			
			line = readLn();
			
		}
		
	}
	
	private static void process(String x, String y) {
		
		Vector a = new Vector();
		Vector b = new Vector();
		
		StringTokenizer st = new StringTokenizer(x);
		
		while (st.hasMoreTokens()) {
			a.addElement(st.nextToken());
		}
		
		st = new StringTokenizer(y);
		
		while (st.hasMoreTokens()) {
			b.addElement(st.nextToken());
		}
		
		if (a.size() == b.size()) {
			
			boolean equals = true;
			
			for (int k = 0; k < a.size(); k++) {
				equals = equals && b.contains(a.elementAt(k));
			}
			
			if (equals) {
				System.out.println("A equals B");
				return;
			}
			
		} else {
			
			boolean aSubset = true;
			
			for (int k = 0; k < a.size(); k++) {
				aSubset = aSubset && b.contains(a.elementAt(k));
			}
			
			
			if (aSubset) {
				System.out.println("A is a proper subset of B");
				return;
			}
			
			boolean bSubset = true;
			
			for (int k = 0; k < b.size(); k++) {
				bSubset = bSubset && a.contains(b.elementAt(k));
			}
			
			
			if (bSubset) {
				System.out.println("B is a proper subset of A");
				return;
			}
			
		}
		
		boolean noneA = false;
		
		for (int k = 0; k < a.size(); k++) {
			noneA = noneA || b.contains(a.elementAt(k));
		}
		
		boolean noneB = false;
		
		for (int k = 0; k < b.size(); k++) {
			noneB = noneB || a.contains(b.elementAt(k));
		}
		
		if (!noneA && !noneB) {
			System.out.println("A and B are disjoint");
			return;
		}
		
		System.out.println("I'm confused!");
	}

	static String readLn() {
		String newLine = System.getProperty("line.separator");
		StringBuffer buffer = new StringBuffer();
		int car = -1;
		try {
			car = System.in.read();
			while ((car > 0) && (car != newLine.charAt(0))) {
				buffer.append((char) car);
				car = System.in.read();
			}
			if (car == newLine.charAt(0))
				System.in.skip(newLine.length() - 1);
		} catch (java.io.IOException e) {
			return (null);
		}
		if ((car < 0) && (buffer.length() == 0))
			return (null);
		return (buffer.toString()).trim();
	}

	
}
